package com.yang.designmode.proxy.dynamicProxy.CGLIBDynamicProxy;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import java.lang.reflect.Method;

public class MyMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
        System.out.println("前置增强逻辑");
        Object result = proxy.invokeSuper(obj, args); // 调用父类原始方法
        System.out.println("后置增强逻辑");
        return result;
    }
}

